关于C#:表面重建错误 | 您所在的位置:网站首页 › pcl 使用教程 › 关于C#:表面重建错误 |
我完全按照此处找到的教程进行了修改,但对输入内容进行了一些修改。然后我的代码是: 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#include #include #include #include #include #include using namespace pcl; int main (int argc, char **argv) { if (argc != 1) { PCL_ERROR ("Syntax: %s input.pcd output.ply\ ", argv[0]); return -1; } PointCloud::Ptr cloud (new PointCloud ()); io::loadPCDFile ("ism_test_cat.pcd", *cloud); MovingLeastSquares mls; mls.setInputCloud (cloud); mls.setSearchRadius (0.01); mls.setPolynomialFit (true); mls.setPolynomialOrder (2); mls.setUpsamplingMethod (MovingLeastSquares::SAMPLE_LOCAL_PLANE); mls.setUpsamplingRadius (0.005); mls.setUpsamplingStepSize (0.003); PointCloud::Ptr cloud_smoothed (new PointCloud ()); mls.process (*cloud_smoothed); NormalEstimationOMP ne; ne.setNumberOfThreads (8); ne.setInputCloud (cloud_smoothed); ne.setRadiusSearch (0.01); Eigen::Vector4f centroid; compute3DCentroid (*cloud_smoothed, centroid); ne.setViewPoint (centroid[0], centroid[1], centroid[2]); PointCloud::Ptr cloud_normals (new PointCloud ()); ne.compute (*cloud_normals); for (size_t i = 0; i size (); ++i) { cloud_normals->points[i].normal_x *= -1; cloud_normals->points[i].normal_y *= -1; cloud_normals->points[i].normal_z *= -1; } PointCloud::Ptr cloud_smoothed_normals (new PointCloud ()); concatenateFields (*cloud_smoothed, *cloud_normals, *cloud_smoothed_normals); Poisson poisson; poisson.setDepth (9); poisson.setInputCloud (cloud_smoothed_normals); PolygonMesh mesh; poisson.reconstruct (mesh); io::saveVTKFile ("sreconstruc.vtk",mesh); return 0; }我正在使用PCL 1.6,VS2010,所有x64。 VS2010在代码中未检测到任何错误,因此我对其进行了编译。但是当我执行该命令时,就会出现问题: 1'Unhandled exception at 0x000007fee833546b (pcl_kdtree_debug.dll) in pcl_surface-reconstrucTutorial.exe: 0xC0000005: Access violation reading location 0x0000000000000000.'终端显示此[pcl::NormalEstimationOMP::compute] input_ is empty!。 代码执行到\\'mls.process(* cloud_smoothed); \\'行。 我该如何解决?我快要解决了。 非常感谢! 相关讨论 我用作输入的文件是这个 您是否使用了教程中提供的默认值?以及相同的文件?可能发生的情况是,如果您使用其他文件,则需要稍微调整一下值,然后得到结果。 (在正常估算下,输入不会为空) 您确定您确实在读取点云文件吗?请尝试使用完整路径(不只是\\'name.pcd \\'),因为当loadPCDFile尝试查找文件,但是该路径中不存在该文件时,您不会得到异常,并且程序继续执行。 @ dim.tziwnas,我检查文件的加载,在加载函数之后插入\\'io :: savePCDFileASCII(" hello.pcd ",* cloud); \\'。它可以正确保存文件。我还像这里一样更改了MovingLeastSquares函数的设置参数,但是什么也没有。它什么都不处理! 大家好,正如@ Laszlo-Andras Zsurzsa所说,我更改了参数,现在继续进行。但是现在,当它执行并保存file.vtk时。什么时候可以找到有关参数的良好解释以获得良好的网格?例如,对于我使用的文件,最好的是什么!再次非常感谢您,主要是Laszlo-Andras Zsurzsa 发布别人可以看到的解决方案。遗憾的是,任何教程都没有很好的解释。您必须查看代码,如果有文章,请在Internet上检查。我没有足够的拒绝,所以我将答案用作对阿卡什问题的评论。 使用Poisson重建时,您只需要关心两个参数:八叉树深度和八叉树每个节点的样本数。在PLC中,八叉树深度以下的Poisson算法的作者为8,每个节点的样本为1.0。您可以将深度更改为10,以获得更平滑的表面效果(当然,这会消耗更多时间)。作者说您应该在10点停下来,因为更大的数字需要更多的时间。八叉树的每个节点的样本应该在1.0到1.5之间,因此我认为没有任何变化。 何时应该使用泊松算法的问题:答案是当您需要重建水密(封闭)对象时,因为泊松算法使用指示符函数来重建表面,因此其结果始终是水密的。 如果您想过去尝试其他Poisson实施,可以在此链接中找到它们 正如@ Laszlo-Andras Zsurzsa所说,我更改了参数,现在继续进行。但是现在,当它执行并保存file.vtk时。我使用此设置来获得良好的效果 |
CopyRight 2018-2019 实验室设备网 版权所有 |